<template>
  <div class="site-content site-content--home">

    <div style=" margin-right: -15px;margin-left: -15px;">
      <div class="col-md-3 col-sm-12 col-xs-12">
        <div class="panel panel-primary text-center no-boder bg-color-green">
          <div class="panel-body">
            <i class="fa fa-user fa-5x"></i>
            <h3>{{ todayIpBuckleCount }}</h3>
          </div>
          <div class="panel-footer back-footer-green">
            当日IP访问量
          </div>
        </div>
      </div>

      <div class="col-md-3 col-sm-12 col-xs-12">
        <div class="panel panel-primary text-center no-boder bg-color-blue">
          <div class="panel-body">
            <i class="fa fa-user-o fa-5x"></i>
            <h3>{{ lastdayIpBuckleCount }}</h3>
          </div>
          <div class="panel-footer back-footer-blue">
            昨日IP访问量
          </div>
        </div>
      </div>

      <div class="col-md-3 col-sm-12 col-xs-12">
        <div class="panel panel-primary text-center no-boder bg-color-red">
          <div class="panel-body">
            <i class="fa fa fa-user-circle fa-5x"></i>
            <h3>{{ todayPuCount }}</h3>
          </div>
          <div class="panel-footer back-footer-red">
            今日广告访问量
          </div>
        </div>
      </div>
      <div class="col-md-3 col-sm-12 col-xs-12">
        <div class="panel panel-primary text-center no-boder bg-color-brown">
          <div class="panel-body">
            <i class="fa fa-user-circle-o fa-5x"></i>
            <h3>{{ lastdayPuCount }}</h3>
          </div>
          <div class="panel-footer back-footer-brown">
            昨日广告访问量
          </div>
        </div>
      </div>
    </div>
    <el-card :style="contentViewStyles">
      <h3>系统公告</h3>
      <div v-html="datas">
        <div>  {{ datas }}</div>
      </div>
    </el-card>
  </div>
</template>
<script>
  import API from '@/api'
  import store from '@/store'         // api: https://github.com/vuejs/vuex
  export default {
    data () {
      return {
        datas: store.state.webInfo.webDesc,
        todayPuCount: 0,
        lastdayPuCount: 0,
        puCount: 0,
        todayIpCount: 0,
        lastdayIpCount: 0,
        todayIpBuckleCount: 0,
        lastdayIpBuckleCount: 0,
        ipCount: 0
      }
    },
    created () {
      this.init()
    },
    methods: {
      init () {
        var userType = store.state.user.type
        if (userType !== 1) {
          API.basemember.infoByUserId(store.state.user.id).then(({data}) => {
            if (data && data.code === 0) {
              if (data.basemember) {
                this.todayPuCount = data.basemember.todayPuCount
                this.lastdayPuCount = data.basemember.lastdayPuCount
                this.todayIpCount = data.basemember.todayIpCount
                this.lastdayIpCount = data.basemember.lastdayIpCount
                this.todayIpBuckleCount = data.basemember.todayIpBuckleCount
                this.lastdayIpBuckleCount = data.basemember.lastdayIpBuckleCount
              }
            }
          })
        } else {
          API.basewebinfo.info(0).then(({data}) => {
            if (data && data.code === 0 && data.basewebinfo) {
              this.todayPuCount = data.basewebinfo.todayPuCount
              this.lastdayPuCount = data.basewebinfo.lastdayPuCount
              this.todayIpCount = data.basewebinfo.todayIpCount
              this.lastdayIpCount = data.basewebinfo.lastdayIpCount
              this.todayIpBuckleCount = data.basewebinfo.todayIpBuckleCount
              this.lastdayIpBuckleCount = data.basewebinfo.lastdayIpBuckleCount
            }
          })
        }
      }
    },
    computed: {
      contentViewStyles () {
        var height = this.$store.state.documentClientHeight
        height -= 50 // site-topbar
        height -= 15 // site-content padding-top
        height -= 15 // site-content padding-bottom
        height += 'px'
        return [
          { minHeight: height }
        ]
      }
    }
  }
</script>

<style>
  .site-content--home {
    line-height: 1.5;
  }

  .col-md-3 {
    width: 25%;
  }
  .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
    float: left;
  }
  .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
    position: relative;
    min-height: 1px;
    padding-right: 15px;
    padding-left: 15px;
  }
  .bg-color-green {
    background-color: #fff;
    color: #5cb85c;
  }
  /*----------------------------------------------
      COMMON  STYLES
  ------------------------------------------------*/
  body {
    font-family: 'Open Sans', sans-serif;
  }

  #wrapper {
    width: 100%;
    background:#09192A;
  }

  #page-wrapper {
    padding: 15px 15px;
    min-height: 600px;
    background:#E5EBF2;

  }
  #page-inner {
    width:100%;
    margin:10px 20px 10px 0px;
    background-color:transparent;
    padding:10px;
    min-height:1200px;
  }
  h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: inherit;
    font-weight: 500;
    line-height: 1.1;
    color: inherit;
  }
  h3, .h3 {
    font-size: 24px;
  }

  .panel-footer {
    padding: 10px 15px;
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    border-bottom-right-radius: 3px;
    border-bottom-left-radius: 3px;
  }
  h1, .h1, h2, .h2, h3, .h3 {
    margin-top: 7px;
    margin-bottom: -5px;
  }
  .col-md-3 {
    width: 25%;
  }
  .panel-body {
    padding: 15px;
  }
  .text-center {
    text-align:center;
  }
  .no-boder {
    border:1px solid #f3f3f3;
  }

  h1, .h1, h2, .h2, h3, .h3 {
    margin-top: 7px;
    margin-bottom: -5px;
  }
  h2 {
    color: #000;
  }
  h4 {
    padding-top:10px;
  }
  .square-btn-adjust {
    border: 0px solid transparent;
    -webkit-border-radius: 0px;
    -moz-border-radius: 0px;
    border-radius: 0px;

  }
  p {
    font-size:16px;
    line-height:25px;
    padding-top:20px;
  }
  /*----------------------------------------------
     DASHBOARD STYLES
  ------------------------------------------------*/
  .page-header {
    padding-bottom: 9px;
    margin: 10px 0 45px;
    border-bottom: 1px solid #C7D1DD;
  }
  .panel-back {
    background-color:#fff;

  }
  .panel-default > .panel-heading {
    color: #000;
    background-color: #FFFFFF;
    border-color: #ddd;
    font-weight:bold;
  }
  .jumbotron, .well{
    background:#fff;
  }
  .noti-box {
    min-height: 100px;
    padding: 20px;
  }

  .noti-box .icon-box {
    display: block;
    float: left;
    margin: 0 15px 10px 0;
    width: 70px;
    height: 70px;
    line-height: 75px;
    vertical-align: middle;
    text-align: center;
    font-size: 40px;
  }
  .text-box p{
    margin: 0 0 3px;
  }
  .main-text {
    font-size: 25px;
    font-weight:600;
  }
  .set-icon {
    -webkit-border-radius: 50px;
    -moz-border-radius: 50px;
    border-radius: 50px;

  }
  .bg-color-green {
    background-color: #fff;
    color: #5cb85c;
  }
  .bg-color-blue {
    background-color: #fff;
    color: #4CB1CF
  }
  .bg-color-red {
    background-color: #fff;
    color:#F0433D;
  }
  .bg-color-brown {
    background-color: #fff;
    color:#f0ad4e;
  }
  .back-footer-green {
    background-color: #5cb85c;
    color:#fff;
    border-top: 0px solid #fff;
  }
  .back-footer-red {
    background-color: #F0433D;
    color:#fff;
    border-top: 0px solid #fff;
  }
  .back-footer-blue {
    background-color: #4CB1CF;
    color:#fff;
    border-top: 0px solid #fff;
  }
  .back-footer-brown {
    background-color: #f0ad4e;
    color:#fff;
    border-top: 0px solid #fff;
  }
  .icon-box-right {
    display: block;
    float: right;
    margin: 0 15px 10px 0;
    width: 70px;
    height: 70px;
    line-height: 75px;
    vertical-align: middle;
    text-align: center;
    font-size: 40px;
  }

  .main-temp-back {
    background: #8702A8;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 300;
    text-align: center;
  }
  .main-temp-back .text-temp {
    font-size: 40px;
  }
  .back-dash {
    padding:20px;
    font-size:20px;
    font-weight:500;
    -webkit-border-radius: 0px;
    -moz-border-radius: 0px;
    border-radius: 0px;
    background-color:#2EA7EB;
    color:#fff;
  }
  .back-dash p {
    padding-top:16px;
    font-size:13px;
    color:#fff;
    line-height:25px;
    text-align:justify;
  }

  .color-bottom-txt {
    color: #000;
    font-size: 16px;
    line-height: 30px;
  }
  /*CHAT PANEL*/
  .chat-panel .panel-body {
    height: 450px;
    overflow-y: scroll;
  }
  .chat-box {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .chat-box li {
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px dotted #808080;
  }
  .chat-box li.left .chat-body {
    margin-left: 90px;
  }
  .chat-box li .chat-body p {
    margin: 0;
    color: #8d8888;
  }
  .chat-img>img {
    margin-left:20px;
  }
  footer p{
    font-size: 14px;
  }
  /*----------------------------------------------
      MENU STYLES
  ------------------------------------------------*/


  .user-image {
    margin: 25px auto;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    border-radius: 10px;
    max-height:170px;
    max-width:170px;
  }
  .top-navbar{
    margin:0px;
  }
  .top-navbar .navbar-brand {
    color: #fff;
    width: 260px;
    text-align: left;
    height: 60px;
    font-size: 30px;
    font-weight: 700;
    text-transform: uppercase;
    line-height: 30px;
  }
  .top-navbar .nav > li {
    position: relative;
    display: inline-block;
  }
  .top-navbar .nav > li > a {
    position: relative;
    display: block;
    padding: 19px 15px;
    color: #77C0FD;
  }
  .top-navbar .nav > li > a:hover, .top-navbar .nav > li > a:focus {
    text-decoration: none;
    background-color: #225081;
    color: #fff;
  }
  .top-navbar .dropdown-menu{
    min-width: 230px;
    border-radius: 0 0 4px 4px;
  }
  .top-navbar .dropdown-menu > li > a:hover, .top-navbar .dropdown-menu > li > a:focus{
    color: #225081;
    background:none;
  }
  .dropdown-tasks{
    width: 255px;
  }
  .dropdown-tasks .progress {
    height: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    background-color: #f5f5f5;
    border-radius: 0px;
  }
  .dropdown-tasks > li > a {
    padding: 0px 15px;
  }
  .dropdown-tasks p {
    font-size: 13px;
    line-height: 21px;
    padding-top: 4px;
  }
  .active-menu {
    background-color:#225081!important;
  }

  .arrow {
    float: right;
  }

  .fa.arrow:before {
    content: "\f104";
  }

  .active > a > .fa.arrow:before {
    content: "\f107";
  }


  .nav-second-level li,
  .nav-third-level li {
    border-bottom: none !important;
  }

  .nav-second-level li a {
    padding-left: 37px;
  }

  .nav-third-level li a {
    padding-left: 55px;
  }
  .sidebar-collapse , .sidebar-collapse .nav{
    background:none;
  }
  .sidebar-collapse .nav {
    padding:0;
  }
  .sidebar-collapse .nav > li > a {
    color:#fff;
    background:transparent;
    text-shadow:none;

  }
  .sidebar-collapse > .nav > li > a {
    padding:15px 10px;
  }
  .sidebar-collapse > .nav > li {
    border-bottom: 1px solid rgba(107, 108, 109, 0.19);
  }
  ul.nav.nav-second-level.collapse.in {
    background: #172D44;
  }
  .sidebar-collapse .nav > li > a:hover,
  .sidebar-collapse .nav > li > a:focus {

    outline:0;
  }

  .navbar-side {
    border:none;
    background-color: transparent;

  }
  .top-navbar {
    background:#09192A;
    border-bottom:none;

  }
  .top-navbar .nav > li > a > i {
    margin-right: 2px;
  }
  .top-navbar .navbar-brand:hover {
    color:#fff;

  }
  .dropdown-user li {
    margin: 8px 0;
  }
  .navbar-default {
    border:0px solid black;

  }
  .navbar-header {
    background: #09192A;
  }
  .navbar-default .navbar-toggle:hover, .navbar-default .navbar-toggle:focus {
    background-color: #B40101;
  }
  .navbar-default .navbar-toggle {
    border-color: #fff;
  }

  .navbar-default .navbar-toggle .icon-bar {
    background-color: #FFF;
  }
  .nav > li > a > i {
    margin-right:10px;
  }
  /*----------------------------------------------
      UI ELEMENTS STYLES
  ------------------------------------------------*/
  .btn-circle {
    width: 50px;
    height: 50px;
    padding: 6px 0;
    -webkit-border-radius: 25px;
    -moz-border-radius: 25px;
    border-radius: 25px;
    text-align: center;
    font-size: 12px;
    line-height: 1.428571429;
  }

  /*----------------------------------------------
      MEDIA QUERIES
  ------------------------------------------------*/

  @media(min-width:768px) {
    #page-wrapper{
      margin: 0 0 0 260px;
      padding: 15px 30px;
      min-height: 1200px;

    }


    .navbar-side {
      z-index: 1;
      position: absolute;
      width: 260px;
    }

    .navbar {
      border-radius: 0px;
    }

  }
  @media(max-width:480px) {
    .page-header small {
      display: block;
      padding-top: 14px;
      font-size: 19px;
    }
  }
</style>

